package j_graphics;
// ============================
// DrawCanvas Example
// make : pwg
// date : 2003
// note : WindowAdapter 사용
// ============================

import java.awt.*;
import java.awt.event.*;

public class  DrawCanvasEx extends Frame
{
	myWindowAdapter myW;
	myCanvas myC;
	public DrawCanvasEx()
	{
		myW = new myWindowAdapter();
		addWindowListener(myW);
		myC= new myCanvas();
		myC.setSize(256,256);
		add(myC);
	}

	public static void main(String[] args) 
	{
		DrawCanvasEx f=new DrawCanvasEx();
		f.setSize(300,300);
		f.setVisible(true);
	}

	class myCanvas extends Canvas
	{
		public void paint(Graphics g)
		{
			g.setColor(new Color(100,200,50));
			g.fillRect(10,10,200,200);
		}
	};

	// WindowAdapter
	class myWindowAdapter extends WindowAdapter
	{
		public void windowClosing(WindowEvent e)
		{
			System.exit(0);
		}
	};
}